package com.ax.business.hemp.controller;

import com.ax.business.common.util.AjaxRes;
import com.ax.business.common.util.Const;
import com.ax.business.hemp.domain.BaseDrugDto;
import com.ax.business.hemp.service.BaseDrugDtoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @Author Lg
 * @Date 2018/9/6 11:36
 * @Content
 */
@RestController
@RequestMapping("/BaseDrugDto/")
public class BaseDrugDtoController {

    @Autowired
    BaseDrugDtoService baseDrugDtoService;

    /**
     * 根据药品名查询药店药品
     * @param ajaxRes
     * @param map
     * @return
     */
    @RequestMapping("queryBaseDrugDto")
    public AjaxRes queryBaseDrugDto(AjaxRes ajaxRes, @RequestBody Map<String,Object> map){
        try {
            List<BaseDrugDto> baseDrugDtos = baseDrugDtoService.queryBaseDrugDto(map);
            ajaxRes.setSucceed(baseDrugDtos, Const.DATA_FAIL);
        }catch (Exception e){
            ajaxRes.setFailMsg(e.getMessage());
        }
        return ajaxRes;
    }

}

